home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Database How-To
/
Visual Basic 4 Database - How-to (The Waite Group)(1995).iso
/
btrieve.fr_
/
btrieve.fr
Wrap
Text File
|
1995-07-05
|
7KB
|
219 lines
VERSION 4.00
Begin VB.Form frmOrders
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
Caption = "Orders"
ClientHeight = 2115
ClientLeft = 1095
ClientTop = 1485
ClientWidth = 7365
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 8.25
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 2520
Left = 1035
LinkTopic = "Form1"
ScaleHeight = 2115
ScaleWidth = 7365
Top = 1140
Width = 7485
Begin VB.CommandButton cmdClose
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "&Cl&ose"
Height = 315
Left = 5940
TabIndex = 10
Top = 1440
Width = 1035
End
Begin VB.CommandButton cmdDelete
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "&Delete"
Height = 315
Left = 4680
TabIndex = 9
Top = 1440
Width = 1035
End
Begin VB.CommandButton cmdAdd
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "&Add"
Height = 315
Left = 3240
TabIndex = 8
Top = 1440
Width = 1155
End
Begin VB.TextBox lblDate
Appearance = 0 'Flat
DataField = "Date"
DataSource = "Data1"
Height = 315
Left = 4140
TabIndex = 3
Top = 780
Width = 1635
End
Begin VB.TextBox lblQuantity
Appearance = 0 'Flat
DataField = "Quantity"
DataSource = "Data1"
Height = 315
Left = 1140
TabIndex = 2
Top = 780
Width = 1215
End
Begin VB.TextBox txtCustomerNumber
Appearance = 0 'Flat
DataField = "Customer Number"
DataSource = "Data1"
Height = 315
Left = 4320
TabIndex = 1
Top = 300
Width = 735
End
Begin VB.TextBox txtISBN
Appearance = 0 'Flat
DataField = "ISBN"
DataSource = "Data1"
Height = 285
Left = 960
TabIndex = 0
Top = 300
Width = 1995
End
Begin VB.Data Data1
Appearance = 0 'Flat
Caption = "Orders"
Connect = "Btrieve;"
DatabaseName = "C:\ACCOUNTS\BTR-ACC\FILE.DDF"
Exclusive = 0 'False
Height = 315
Left = 300
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "SELECT * FROM ORDERS ORDER BY ISBN"
Top = 1440
Width = 2535
End
Begin VB.Label Label4
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "&Date Ordered:"
ForeColor = &H80000008&
Height = 195
Left = 2820
TabIndex = 7
Top = 810
Width = 1215
End
Begin VB.Label Label3
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "&Quantity:"
ForeColor = &H80000008&
Height = 195
Left = 300
TabIndex = 6
Top = 810
Width = 780
End
Begin VB.Label lblCustomerNumber
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "&Customer #:"
ForeColor = &H80000008&
Height = 195
Left = 3240
TabIndex = 5
Top = 330
Width = 1035
End
Begin VB.Label lblISBN
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "&ISBN:"
ForeColor = &H80000008&
Height = 195
Left = 360
TabIndex = 4
Top = 330
Width = 510
End
End
Attribute VB_Name = "frmOrders"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Dim rs As Dynaset
Private Sub cmdAdd_Click()
' Use the AddNew method of the data control's Recordset property to add a new record to the data base.
rs.AddNew
' Set the focus to the first field on the form.
txtISBN.SetFocus
End Sub
Private Sub cmdClose_Click()
' If the user added a new record or made changes to an existing record
' save the changes.
Unload frmOrders
' Close the application
End
End Sub
Private Sub cmdDelete_Click()
If MsgBox("Do you want to delete this order?", vbQuestion + vbYesNo + vbDefaultButton2) = vbYes Then
rs.Delete
rs.MoveNext
If rs.EOF Then
If rs.RecordCount = 0 Then
EmptyRecordset
Else
rs.MovePrevious
End If
End If
End If
End Sub
Private Sub EmptyRecordset()
' Gives the user a chance to add a record to the data base. If the user
' elects not to add a record, the program terminates.
Dim msg1 As String, msg2 As String, msg3 As String
msg1 = "There are no customer records in the data base. "
msg2 = "Do you want to add a new blank record? "
msg3 = "(If you answer no, the program will terminate.)"
If MsgBox(msg1 & msg2 & msg3, vbQuestion + vbYesNo) = vbYes Then
cmdAdd_Click
Else
End
End If
End Sub
Private Sub Form_Activate()
Set rs = data1.Recordset
If rs.RecordCount = 0 Then EmptyRecordset
End Sub